#pragma once

#include <iostream> 
#include <pthread.h>

class Mutex
{
private:

    pthread_mutex_t* _pmtx ;

public:

    Mutex(pthread_mutex_t* mtx)
        :_pmtx(mtx)
    {

    }

    void lock()
    {
        pthread_mutex_lock(_pmtx);
    }

    void unlock()
    {
        pthread_mutex_unlock(_pmtx);
    }

    ~Mutex()
    {

    }
};



class myLockGuard
{
private:

    Mutex _mtx;

public:
    
    myLockGuard(pthread_mutex_t* mtx)
        :_mtx(mtx)
    {
        _mtx.lock();
    }

    ~myLockGuard()
    {
        _mtx.unlock();
    }

};











